package com.lee.ssm.service.impl;

import com.github.pagehelper.PageHelper;
import com.lee.ssm.dao.IProductDao;
import com.lee.ssm.domain.Product;
import com.lee.ssm.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("iProductService")
@Transactional
public class ProductServiceImpl  implements IProductService{
    @Autowired
    private IProductDao iProductDao;

    @Override
    public List<Product> findAll(String pageStr, String sizeStr) throws Exception {
        int page=Integer.parseInt(pageStr);
        int size=Integer.parseInt(sizeStr);
        PageHelper.startPage(page,size);
        List<Product> list = iProductDao.findAll();
        return list;
    }

    @Override
    public void save(Product product) {
        iProductDao.save(product);
    }
}
